1. Field of the Invention
The present invention relates to caches for databases and servers. More specifically, the present invention relates to a method and an apparatus for facilitating selecting an item from a cache based on a rank-order of the item.
2. Related Art
In order to increase performance while servicing multiple requests, many computer systems store items that are likely to be accessed in a local cache. These items can be accessed more quickly from the local cache than from a remote data store. However, caches have certain limitations.
For example, caches can only hold a limited number of items. Hence, caches typically use certain criteria for determining whether to add items to the cache, as well as certain eviction criteria for determining whether to remove items from the cache. These criteria can be selected based on cache access patterns and computer system preferences. However, if these criteria and preferences switch rapidly, the computer systems may have to maintain several pre-sorted caches (one for each access pattern) to achieve satisfactory performance. However, such a system may be cost-prohibitive if there are a very large number of cache eviction criteria. Furthermore, this approach is also wasteful in terms of disk space and memory.